home *** CD-ROM | disk | FTP | other *** search
- /*
- Solution / Keygen source to Hotdog's Crackme #1
- -----------------------------------------------
-
- Written by Prophecy [tNO] (27th July 1998)
- ------------------------------------------
-
- BTW , if you have any questions you'd like to ask, or any errors to point out, feel
- free to email me : prophecy_@usa.net OR catch me in #cracking4newbies in EFNET.
-
- Well I promised my friend i'd crack this by 10pm tonight otherwise he'd be asleep,
- so if you see any mistakes it was coz i'm in a rush to finish it (it's 8:54pm
- already!)
-
- Cracking techniques
- -------------------
-
- I used bpx multibytetowidechar to break into the target, type dd esp to examine
- the stack and hence work out where my padded name / regcode would be stored - read
- your api reference!
-
- As this is a visual basic not much can be said -- you need a fair bit of
- experience so that you can separate the VB shit from the actual code
- generating algo - newbies would get too scared so much VB code and the fact
- that VB copies your name/code to about 1000000 locations in memory before
- it finally does anything about it.
-
- Anyway : here are a couple of addresses that bring you bang in the middle of the
- code algorithm (you have to type ADDR codeman before you enter it, and to enter
- it type bpx <address>)
-
- Note : read next session : the protection scheme itself before reading my commments in ()
-
- 417235 ( you should see your mapped character , and you should see the _vbaadd something
- command. Note if you trace long enough you will see your name being looked
- up in the table using the REPZ CMSB command to check if it's found your letter
- in the table yet )
-
- 417296 ( the final comparison )
-
- the protection scheme itself
- ----------------------------
-
- as i already said the main prob is finding the shit in Sofitce -- for some reason,
- i dunno why as Hotdog told me he had no anti smartcheck tricks, this crackme
- crashed smartcheck -- nice one hotdog :) , which forced me to use Softice, but being
- a man i can handle it.
-
- 1) first, your name is converted to uppercase.
-
- then it manipulates your name in the following fashion:
-
- if you entered a A (0x41) (gets mapped to) -> e (0x65)
- B (0x42) -> f (0x66)
- C (0x43) -> g (0x67)
- .
- .
- Z (0x5a) -> ~ (0x7e)
-
- so basically all that happens is that 0x24 is added to the chars of your name.
-
- if the char you enter is not found in the table, then the value 0x7f is used.
-
- btw, i tried to find the table the crackme was using for the mapping, and to
- my amusement i saw this:
-
- test ax,ax
- mov [ebp-7c], 00000065
- .
- test ax,ax
- mov [ebp-7c], 00000066
- .
- test ax,ax
- mov [ebp-7c], 00000067
- .
- .
- .
- test ax,ax
- mov [ebp-7c], 0000007e
- .
- test ax,ax
- mov [ebp-7c], 0000007f
-
- talk about bad programming style! i would done something like add xx,0x24
- where xx is the mapped char. with an if statement to check if it's a letter.
-
- anyway, back to the algo : i entered Prophecy, which gets converted to
- upper case -> PROPHECY. Then the chars get mapped to give me tvstlig}.
-
- the individual letters of the new code "tvstlig}" are added together, ie
-
- 0x74+0x76+0x73+0x74+0x6c+0x69+0x67+0x7d = 0x38a.
-
- then the code adds the value 0x989680, which is exactly 10 000 000, hence explaining
- the 8 digit nature of the valid code.
-
- this gives : 10 000 906 (0x38a = 906d)
-
- as a final touch, the length of your name is added to this figure to give:
-
- 10 000 906 + 8 = 10 000 914 <--- valid code for "PROPHECY" !!
-
- So writing a keygen should be a trivial exercise (it's 9:20, which gives me 40 mins
- ... so let's rock!)
-
- */
-
- #include <stdio.h>
- #include <string.h>
- #include <conio.h>
- #include <ctype.h>
-
- int main(){
-
- unsigned char name[500]={0};
- unsigned long code=0;
- unsigned int i,len;
-
- for(;;){
- clrscr();
- printf("┌─────── ░ ─── ▄ ─────── ░ ────────────┐\n");
- printf("■▀██▓▀███▓▀██▓▀██▓▄ ▄▓█▓ ▀▓██▓▀███▓▀ │\n");
- printf("│ ▀░ ███▓ █░ ███▀▓▄ ███▓ ███▓ ███▓ │\n");
- printf("│ ░███▓ ░███ █████▓ ░███▓ ███▓ │\n");
- printf("│ ▄▓███▓▄ ▄▓███▓▄ ▀▓██▓▄▓███▓▄▓██▓▄ │\n");
- printf("└───────────────────── ▀▀▓ ────────────┘\n");
- printf("\nKey Generator for Hotdog's Crackme #1");
- printf("\nWritten by Prophecy (27th July 1998)\n\n");
- printf("Please enter your name ...: ");
- gets(name);
-
- /* calculate length of name */
- len=strlen(name);
-
- if(len<5 || len>29){ /* name must be >= or <= 29 chars -- this is given to you when you try and enter a name of invalid length by the prog */
- printf("\nYour name contains an invalid amount of characters... try again.");
- getch();
- }
- else break;
- }
-
- for(i=0;i<len;i++){
- name[i]=toupper(name[i]);
- }
-
- for(i=0;i<len;i++){
- if(name[i] < 'A' || name[i] > 'Z'){
- name[i]=0x7f;
- }
- else name[i]+=0x24;
- }
-
- for(i=0;i<len;i++){
- code+=name[i];
- }
-
- code+=10000000LU;
- code+=len;
-
- printf("Your code is: ............: %lu",code);
- /* ok 9:42pm , plenty of time :) */
- }
-
-